import request from '@/utils/request'

export function listCaseCategory(params) {
  return request({
    url: '/test/case/classify',
    method: 'get',
    desc: '获取用例节点树数据',
    params
  })
}

export function addNode(data) {
  return request({
    url: '/test/case/classify?c=addClassify',
    method: 'post',
    desc: '添加用例目录节点',
    data
  })
}

export function editNode(data) {
  return request({
    url: '/test/case/classify?c=editClassify',
    method: 'post',
    desc: '编辑用例目录节点',
    data
  })
}

export function delNode(data) {
  return request({
    url: '/test/case/classify?c=delClassify',
    method: 'post',
    desc: '删除用例目录节点',
    data
  })
}

export function caseList(params) {
  return request({
    url: '/test/case',
    method: 'get',
    desc: '用例列表',
    params
  })
}

export function caseEdit(data) {
  return request({
    url: '/test/case?c=edit',
    method: 'post',
    desc: '用例编辑',
    paramType: 'formData',
    data
  })
}

export function caseDel(data) {
  return request({
    url: '/test/case?c=del',
    method: 'post',
    desc: '用例删除',
    paramType: 'formData',
    data
  })
}

export function changeCaseClass(node_id, data) {
  return request({
    url: '/test/case/classify?c=changeCaseClass&node_id=' + node_id,
    method: 'post',
    desc: '修改用例的目录',
    data
  })
}

export function listSteps(params) {
  return request({
    url: '/test/step',
    method: 'get',
    desc: '用例步骤列表',
    params
  })
}

export function stepEdit(data) {
  return request({
    url: '/test/step?c=edit',
    method: 'post',
    desc: '步骤编辑',
    paramType: 'formData',
    data
  })
}

export function getStepInfo(data) {
  return request({
    url: '/test/step?c=stepInfo',
    method: 'post',
    desc: '获取步骤信息',
    paramType: 'formData',
    data
  })
}

export function delStep(data) {
  return request({
    url: '/test/step?c=del',
    method: 'post',
    desc: '删除步骤',
    paramType: 'formData',
    data
  })
}

export function sortStep(data) {
  return request({
    url: '/test/step?c=stepsSort',
    method: 'post',
    desc: '步骤排序',
    data
  })
}

export function stepParams(params) {
  return request({
    url: '/test/step?c=params',
    method: 'get',
    desc: '查询步骤参数',
    params
  })
}
